package com.gongzhiyun.springboot3test.entity.user;

import com.baomidou.mybatisplus.annotation.*;
import com.gongzhiyun.springboot3test.validate.CommonValidate;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.util.Date;

@Data
@TableName("tb_user")
@Schema(description = "用户表")
public class TbUser implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    @Schema(description = "用户id", example = "1")
    private Integer uid;
    @NotBlank(message = "账号不能为空", groups = {CommonValidate.reg.class})
    @Schema(description = "账号", example = "gzy")
    private String username;
    @NotBlank(message = "密码不能为空", groups = {CommonValidate.reg.class})
    @Schema(description = "密码", example = "123456")
    private String password;
    @TableField(updateStrategy = FieldStrategy.NEVER)
    @Schema(description = "盐值", example = "123456")
    private String salt;
    @TableField(updateStrategy = FieldStrategy.NEVER)
    @Schema(description = "角色", example = "1")
    private Integer role;
    @TableLogic
    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    @Schema(description = "是否删除", example = "0")
    private String deleted;
    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    @Schema(description = "最后更新时间", example = "2023-05-01 12:00:00")
    private Date lastupdate;
}
